/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Database;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Windlord
 */
public class WhereCondition {
    private List<String> conditionList;//cac dieu kien a>=b
    private List<String> _LeftString;
    private List<String> _RightString;
    private List<String> _Operator;
    private List<String> andorList;
    private List<Ve> VeTrai;
    private List<Ve> VePhai;
    public WhereCondition()
    {
        conditionList=new ArrayList<String>();
        andorList=new ArrayList<String>();
        _LeftString=new ArrayList<String>();
        _RightString=new ArrayList<String>();
        _Operator=new ArrayList<String>();
        VeTrai=new ArrayList<Ve>();
        VePhai=new ArrayList<Ve>();
    }
    public void Clear()
    {
        conditionList.clear();
        andorList.clear();
        _Operator.clear();
        _LeftString.clear();
        _RightString.clear();
    }
    public void SetConditionList(List<String> ls)
    {
        conditionList=ls;
        for (int i=0;i<conditionList.size();i++)
        {
            String operator="=";
            if (conditionList.get(i).contains(">"))
                operator=">";
            if (conditionList.get(i).contains("<"))
                operator="<";
            if (conditionList.get(i).contains("="))
                operator="=";
            if (conditionList.get(i).contains(">="))
                operator=">=";
            if (conditionList.get(i).contains("<="))
                operator="<=";
            if (conditionList.get(i).contains("!="))
                operator="!=";
           _Operator.add(operator);
           String[] temp=conditionList.get(i).split(operator);
           _LeftString.add(temp[0]);
           _RightString.add(temp[1]);
        }
        
    }
    public void SetAndOrList(List<String> ls)
    {
        andorList=ls;
    }
    public List<String> GetConditionList()
    {
        return conditionList;
    }
    public List<String> GetAndOrList()
    {
        return andorList;
    }
    public List<String> GetLeftString()
    {
        return _LeftString;
    }
    public List<String> GetLRightString()
    {
        return _RightString;
    }
    public List<String> GetOperator()
    {
        return _Operator;
    }
    public List<Ve> GetVeTrai()
    {
        return VeTrai;
    }
    public List<Ve> GetVePhai()
    {
        return VePhai;  
    }
    public void SetLeftString(List<String> lstr)
    {
        _LeftString=lstr;
    }
    public void SetLRightString(List<String> lstr)
    {
        _RightString=lstr;
    }
    public void SetOperator(List<String> lstr)
    {
        _Operator=lstr;
    }
    public void SetVeTrai(List<Ve> ve)
    {
        VeTrai=ve;
    }
    public void SetVePhai(List<Ve> ve)
    {
        VePhai=ve;
    }
}
